package com.biz.utils;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

public class DisplayAllTags  extends TagSupport{
	 private static final long serialVersionUID = 1L;   
	  
	    public DisplayAllTags() {   
	        System.out.println("displayaddtags 构造函数");   
	    }   
	  
	    public int doStartTag() throws JspException {   
	        System.out.println("doStartTag函数");   
	           
	        return SKIP_BODY;  //不实现标签的体，即空体标签。   
	    }   
	  
	    public int doEndTag() throws JspException {   
	        System.out.println("doEndTag函数");   
	        //查询数据库   
	        //StudentDao studentDao=new StudentDao();   
	        ArrayList arrayList= new ArrayList();//(ArrayList)studentDao.queryStus();   
	           
	        //通过父类TagSupport的属性值pageContext 取得相关的内置对象   
	        JspWriter out=pageContext.getOut();   
	        //遍历循环打印。   
	       
	        try {   
	            out.println("<table>");   
	            out.println("<tr>");   
	            out.println("<td>学号</td>");   
	            out.println("<td>姓名</td>");   
	            out.println("<td>性别</td>");   
	            out.println("<td>出生年月</td>");   
	            out.println("<td>家庭住址</td>");   
	            out.println("</tr>");   
//	           for(int i=0;i<arrayList.size();i++){   
	                //Student student=(Student)arrayList.get(i);   
	                out.println("<tr>");   
	                out.println("<td>1</td>");   
	                out.println("<td>刘佳佳</td>");   
	                out.println("<td>男</td>");   
	                out.println("<td>1986-07-21</td>");   
	                out.println("<td>好</td>");   
	                out.println("</tr>");   
//	            }   
	            out.println("<table>"); 
	            
	            out.println("<select class='combox'>");
	            out.print("<option value='0'>请选择</option>");
	            out.print("<option value='1'>2</option>");
	            out.print("<option value='2'>3</option>");
	            out.println("</select>");
	        } catch (IOException e) {   
	            e.printStackTrace();   
	        }   
	               
	        //=============pageContext还可以get更多的内置对象。   
//	      pageContext.getRequest();   
//	      pageContext.getResponse();   
//	      pageContext.getSession();   
//	      pageContext.getServletContext();   
	        return EVAL_PAGE;   //   
	    }   
}
